#include "../src/common/utils/Logger.h"
#include "../src/SDLtoolkit/widgets/TextScrollBar.h"

void testTextScrollBar() {
	SDLEngine* engine = new SDLEngine("prueba text scroll bar", 800, 600, 24);

	engine->start();

	std::list<string> textElements;
	textElements.push_back("scroll1");
	textElements.push_back("scroll2");
	textElements.push_back("scroll3");
	textElements.push_back("scroll4");
	textElements.push_back("scroll5");
	textElements.push_back("scroll6");
	textElements.push_back("scroll7");
	textElements.push_back("scroll8");
	textElements.push_back("scroll10");
	textElements.push_back("scroll11");
	textElements.push_back("scroll12");
	textElements.push_back("scroll13");
	textElements.push_back("scroll14");

	TextScrollBar* scroll = new TextScrollBar(20, 20, engine->getMainSurface(), textElements);

	scroll->appendElement("Scrolll9");

	Event* eventoloco = new Event();

	bool quit = false;
	while (quit == false) {
		while (engine->pullEvent(eventoloco)) {
			scroll->handleEvent(*eventoloco);
			engine->refreshScreen();

			if (eventoloco->getType() == Quit) {
				quit = true;
			}
		}
	}

	engine->stop();

	Logger::log("Tests", "text scroll bar", "Finalizado.");
}
